import { YAMLSeq as r } from '../nodes/YAMLSeq.js';
import { resolveProps as h } from './resolve-props.js';
import { flowIndentCheck as q } from './util-flow-indent-check.js';
function A({ composeNode: u, composeEmptyNode: d }, n, m, o, f) {
  const p = (f == null ? void 0 : f.nodeClass) ?? r,
    i = new p(n.schema);
  n.atRoot && (n.atRoot = !1);
  let s = m.offset,
    l = null;
  for (const { start: c, value: t } of m.items) {
    const e = h(c, {
      indicator: 'seq-item-ind',
      next: t,
      offset: s,
      onError: o,
      startOnNewline: !0,
    });
    if (!e.found)
      if (e.anchor || e.tag || t)
        t && t.type === 'block-seq'
          ? o(
              e.end,
              'BAD_INDENT',
              'All sequence items must start at the same column',
            )
          : o(s, 'MISSING_CHAR', 'Sequence item without - indicator');
      else {
        (l = e.end), e.comment && (i.comment = e.comment);
        continue;
      }
    const a = t ? u(n, t, e, o) : d(n, e.end, c, null, e, o);
    n.schema.compat && q(m.indent, t, o), (s = a.range[2]), i.items.push(a);
  }
  return (i.range = [m.offset, s, l ?? s]), i;
}
export { A as resolveBlockSeq };
